package com.restaurant.application.indexes.signinlist;

import com.nebutown.commonunits.dataface.definitions.TableData;
import com.nebutown.description.DataTypes;
import com.nebutown.description.IndexGen;
import com.nebutown.description.UnitDescription;
import com.nebutown.description.data.Contributor;
import com.nebutown.description.data.IndexUnit;
import com.nebutown.description.data.SQLColumn;
import com.restaurant.application.genshanguser.GenShangUser;
import com.restaurant.application.indexes.signinlist.mysql.SignInListCriteria;

public class AssistSignInListDesc extends UnitDescription {

    public static void main(String[] args) {
        UnitDescription desc = UnitDescription.basicUnit(AssistSignInList.class, null);
        desc.nextBean("SignInListPageData")
                .add("tableData", TableData.class)
                .add("doSearchPath", String.class)
        ;

        desc
                .addUiFunction("doSearchPath", SignInListCriteria.class.getName())
        ;

        desc.run("./");
        IndexGen.run(getDescription(), "src/main/java");
    }

    public static IndexUnit getDescription() {
        return new IndexUnit()
                .withName("SignInList")
                .withPackageName(AssistSignInListDesc.class.getPackage().getName() + ".mysql")
                .withSrcLocation("./")
                .addContributors(new Contributor()
                        .withName("signInUid")
                        .withNullable(false)
                        .withUnique(true)
                        .withUnitType(GenShangUser.class.getName())
                        .addContribution(new SQLColumn()
                                .withName("signTime")
                                .withType(DataTypes.LONG)
                                .withLabel("签到时间")
                                .withWidth(255)))
                .addContributors(new Contributor()
                        .withName("customerUid")
                        .withNullable(false)
                        .withUnique(true)
                        .withUnitType(GenShangUser.class.getName())
                        .addContribution(new SQLColumn()
                                .withName("customerName")
                                .withType(DataTypes.STRING)
                                .withLabel("客户名")
                                .withWidth(255))
                        .addContribution(new SQLColumn()
                                .withName("realName")
                                .withType(DataTypes.STRING)
                                .withLabel("真实姓名")
                                .withWidth(255))


                );
    }
}
